package com.kk.repository;

import com.kk.model.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by huang on 2018/8/14.
 */
public interface UserRepository extends JpaRepository<User, String> {
    //按照驼峰命名规则来如数据库中的字段为username，则此处因为findByUsername，而不是findByUserName，因为它解析出来的为userName
    User findByUsername(String name);

    @Query("select u from User u where u.username like %?1%")
    List<User> findByUsernameLike(String username);

}
